package com.dream.technology.service;

import com.dream.technology.components.context.FlowContext;
import com.dream.technology.db.entity.RcFlowLog;
import com.dream.technology.db.entity.RcFlowLogQuery;
import com.dream.technology.db.entity.vo.VoCustomerTag;
import com.dream.technology.db.entity.vo.VoFlowAll;
import com.dream.technology.db.entity.vo.VoRuleAll;
import com.dream.technology.db.entity.vo.VoRuleCollectionAll;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 描述：记录流程
 * 1 命中的标签
 * 2 每一条规则 不管通过还是拒绝
 * 3 每个规则集通过拒绝状态
 * 4 异常日志入库
 *
 * @author chen_q_i@163.com
 * 2019/1/9 : 14:12.
 * @version : 1.0
 */
public interface RcFlowLogService {


    int countByExample(RcFlowLogQuery example);

    int deleteByExample(RcFlowLogQuery example);

    int deleteByPrimaryKey(Long id);

    int insert(RcFlowLog record);

    int insertSelective(RcFlowLog record);

    List<RcFlowLog> selectByExample(RcFlowLogQuery example);

    RcFlowLog selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") RcFlowLog record, @Param("example") RcFlowLogQuery example);

    int updateByExample(@Param("record") RcFlowLog record, @Param("example") RcFlowLogQuery example);

    int updateByPrimaryKeySelective(RcFlowLog record);

    int updateByPrimaryKey(RcFlowLog record);

    /**
     * 插入 标签
     *
     * @param context
     * @param tag
     * @param b       是否拒绝
     * @return
     */
    int insertTag(FlowContext context, VoFlowAll voFlowAll, VoCustomerTag tag, boolean b) throws Exception;

    /**
     * 插入 规则
     *
     * @param context
     * @param tag
     * @param b       是否拒绝
     * @return
     */
    int insertRule(FlowContext context, VoFlowAll voFlowAll, VoRuleCollectionAll voRuleCollectionAll, VoRuleAll tag, boolean b, boolean stratyge) throws Exception;

    /**
     * 插入 规则集
     *
     * @param context
     * @param tag
     * @param b       是否拒绝
     * @return
     */
    int insertCollect(FlowContext context, VoFlowAll voFlowAll, VoRuleCollectionAll tag, boolean b, boolean stratyge) throws Exception;

    /**
     * 插入 异常
     *
     * @param context
     * @param e
     * @param       是否拒绝
     * @return
     */
    int insertExcption(FlowContext context, VoFlowAll voFlowAll, Exception e) throws Exception;


    List<RcFlowLog> selectControlFlowLog(Long customerId, String name);
}
